//
//  DetailViewController.m
//  WWallet
//
//  Created by Aries on 11-9-23.
//  Copyright 2011年 bit. All rights reserved.
//

#import "DetailViewController.h"


@implementation DetailViewController

@synthesize expense;
@synthesize labelRemark;
@synthesize labelTitle;
@synthesize labelAmount;
@synthesize labelDirection;
@synthesize labelDate;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)dealloc
{
    [labelRemark release];
    [labelTitle release];
    [labelAmount release];
    [labelDirection release];
    [labelDate release];
    [super dealloc];
}

- (void)didReceiveMemoryWarning
{
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    
    // Release any cached data, images, etc that aren't in use.
}

#pragma mark - View lifecycle

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    
    NSDateFormatter *dateFormatter = [NSDateFormatter new];
    [dateFormatter setDateFormat:@"yyyy-MM-dd"];
    
    labelTitle.text = expense.Title;
    labelAmount.text = [NSString stringWithFormat:@"%.2f", expense.Amount];
    labelDirection.text = expense.IsExpense?@"支出":@"收入";
    labelDate.text = [dateFormatter stringFromDate:expense.ExpenseTime];
    labelRemark.text=expense.Remark;
    
    [dateFormatter release];
}

- (void)viewDidUnload
{
    [self setLabelRemark:nil];
    [self setLabelTitle:nil];
    [self setLabelAmount:nil];
    [self setLabelDirection:nil];
    [self setLabelDate:nil];
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

@end
